package com.cj.pj.sys.service.impl;

import com.cj.pj.sys.common.annotation.AddLogs;
import com.cj.pj.sys.common.exception.ServiceException;
import com.cj.pj.sys.dao.SysMenuDao;
import com.cj.pj.sys.pojo.Node;
import com.cj.pj.sys.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysMenuServiceImpl implements SysMenuService {

    @Autowired
    SysMenuDao sysMenuDao;
    @Override
    public List<Map<String, Object>> findMenus() {
        return sysMenuDao.findAllMenu();
    }

    @Override
    @AddLogs("删除菜单")
    public String deleteMenuById(Integer id) {
        if(id==null)throw new ServiceException("所选删除内容不存在");
       return "成功删除"+ sysMenuDao.deleteMenuById(id)+"个菜单";
    }

    @Override
    public List<Node> getNode() {
        return sysMenuDao.getNode();
    }
}
